parse.com - Android Activity isn't getting started from Parse Notification -
i'm having odd problem parse notifications on android.
it occurs in situation application isn't running, notification received , application started. first notification correctly start default push callback activity subsequent notifications not start activity! making notifications impossible detect.
when application started it's icon callback activities correctly started , see oncreate function called. when started icon fails.
i've correctly added permissions , application manifest additions. i've specified following class application initialises parse api , sets callback.
package com.distriqt.example.test; import android.app.application; import com.parse.parse; import com.parse.parseinstallation; import com.parse.pushservice; public class mainapplication extends application { public static string parse_application_id = "xxxx"; public static string parse_client_key = "yyyy"; @override public void oncreate() { super.oncreate(); parse.setloglevel( parse.log_level_debug ); parse.initialize( this, parse_application_id, parse_client_key ); pushservice.setdefaultpushcallback( this, parsecallbackactivity.class ); parseinstallation.getcurrentinstallation().saveinbackground(); } }
my callback activity looks following. i'm starting main package activity , processing on notification here, before finishing activity immediately.
package com.distriqt.example.test; import android.app.activity; import android.content.intent; import android.content.pm.packagemanager; import android.os.bundle; import android.util.log; public class parsecallbackactivity extends activity { public static string tag = parsecallbackactivity.class.getsimplename(); @override public void oncreate( bundle savedinstancestate ) { super.oncreate( savedinstancestate ); log.d( tag, "oncreate()" ); packagemanager pm = getpackagemanager(); intent mainappintent = pm.getlaunchintentforpackage( getpackagename() ); mainappintent.putextras( getintent().getextras() ); mainappintent.addflags( intent.flag_activity_reorder_to_front ); startactivity( mainappintent ); printintent( getintent() ); finish(); } public static void printintent( intent intent ) { try { log.d( tag, "action = " + intent.getaction() ); if (intent.getextras() != null) { string channel = intent.getextras().getstring("com.parse.channel"); jsonobject json = new jsonobject(intent.getextras().getstring("com.parse.data")); log.d( tag, "=============================================="); log.d( tag, string.format( "channel: %s", channel )); log.d( tag, string.format( "json: %s", json )); log.d( tag, "=============================================="); } } catch (exception e) { } } }
the mainactivity has nothing more example layout @ moment. i'm @ loss...
you declared activity notification in androidmanifest.xml?
Comments
Post a Comment