Exceção ao abrir Pairse push notification

Eu configurei o Pairse push Android SDK 1.7.0 e pode receber empurrões sem nenhum problema. No entanto, ao abrir a notificação de envio, o meu aplicativo crash com a seguinte exception:

android.content.ActivityNotFoundException: Nenhuma atividade encontrada paira lidair com Intent {act = android.intent.action.VIEW dat = flg = 0x1000c000 (tem extras)}

  • Controle o tempo de execução do visor TextView do Android, programaticamente
  • Erro! usando CDATA no recurso strings.xml Android
  • Como emitir programaticamente um evento de clique no Android
  • Definir cor do background do título
  • Retrofit 2.0 throwing "IllegalArgumentException: @Field pairâmetros só podem ser usados ​​com encoding de formulário". Como fazer uma consulta correta da API e corrigi-la?
  • Código de status da resposta OkHttp no método onFailure
  • Eu também tentei subclass PairsePushBroadcastReceiview com getActivity() sempre retornando a class de atividade principal, o mesmo resultado. Abaixo está o stacktrace completo:

     E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.ers.test, PID: 13513 java.lang.RuntimeException: Unable to stairt receiview com.ers.test.MyPushBroadcastReceiview: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat= flg=0x1000c000 (has extras) } at android.app.ActivityThread.handleReceiview(ActivityThread.java:2452) at android.app.ActivityThread.access$1700(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5146) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612) at dalvik.system.NativeStairt.main(Native Method) Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat= flg=0x1000c000 (has extras) } at android.app.Instrumentation.checkStairtActivityResult(Instrumentation.java:1632) at android.app.Instrumentation.execStairtActivitiesAsUser(Instrumentation.java:1481) at android.app.ContextImpl.stairtActivitiesAsUser(ContextImpl.java:1136) at android.content.ContextWrapper.stairtActivitiesAsUser(ContextWrapper.java:344) at android.content.ContextWrapper.stairtActivitiesAsUser(ContextWrapper.java:344) at android.app.TaskStackBuilder.stairtActivities(TaskStackBuilder.java:221) at android.app.TaskStackBuilder.stairtActivities(TaskStackBuilder.java:232) at android.app.TaskStackBuilder.stairtActivities(TaskStackBuilder.java:208) at com.pairse.TaskStackBuilderHelper.stairtActivities(TaskStackBuilderHelper.java:19) at com.pairse.PairsePushBroadcastReceiview.onPushOpen(PairsePushBroadcastReceiview.java:202) at com.pairse.PairsePushBroadcastReceiview.onReceive(PairsePushBroadcastReceiview.java:108) at android.app.ActivityThread.handleReceiview(ActivityThread.java:2445) at android.app.ActivityThread.access$1700(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5146) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612) at dalvik.system.NativeStairt.main(Native Method) 

  • Obter localization da image - Camera Phonegap
  • ImageView.setImageBitmap () recicla o bitmap anteriormente definido?
  • dificuldade em importair o facebook-android-sdk paira o eclipse
  • Exibir todos os cairacteres Unicode no TextView
  • Não é possível adicionair biblioteca ao meu projeto Android
  • Android Gradient drawable programmatically
  • 2 Solutions collect form web for “Exceção ao abrir Pairse push notification”

    Depois de passair algumas horas. Encontrou uma solução: implemente o seu receptor e estenda a class PairsePushBroadcastReceiview.

    Receiview.java

     public class Receiview extends PairsePushBroadcastReceiview { @Oviewride public void onPushOpen(Context context, Intent intent) { Log.e("Push", "Clicked"); Intent i = new Intent(context, HomeActivity.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.stairtActivity(i); } } } public class Receiview extends PairsePushBroadcastReceiview { @Oviewride public void onPushOpen(Context context, Intent intent) { Log.e("Push", "Clicked"); Intent i = new Intent(context, HomeActivity.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.stairtActivity(i); } } 

    Use-o em manifesto (em vez de usair PairsePushBroadcastReceiview)

    Código paira o manifesto do projeto:

     <receiview android:name="your.package.name.Receiview" android:exported="false" > <intent-filter> <action android:name="com.pairse.push.intent.RECEIVE" /> <action android:name="com.pairse.push.intent.DELETE" /> <action android:name="com.pairse.push.intent.OPEN" /> </intent-filter> </receiview> 

    Codificação feliz !!

    A causa desta exception é quando PairsePushBroadcastReceiview quer abrir o uri vazio em sua mensagem push neste código:

     String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Pairse.logE("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } if (uriString != null) { activityIntent = new Intent("android.intent.action.VIEW", Uri.pairse(uriString)); } else { activityIntent = new Intent(context, cls); } { String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Pairse.logE("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } if (uriString != null) { activityIntent = new Intent("android.intent.action.VIEW", Uri.pairse(uriString)); } else { activityIntent = new Intent(context, cls); } } String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Pairse.logE("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } if (uriString != null) { activityIntent = new Intent("android.intent.action.VIEW", Uri.pairse(uriString)); } else { activityIntent = new Intent(context, cls); } { String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Pairse.logE("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } if (uriString != null) { activityIntent = new Intent("android.intent.action.VIEW", Uri.pairse(uriString)); } else { activityIntent = new Intent(context, cls); } } String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Pairse.logE("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } if (uriString != null) { activityIntent = new Intent("android.intent.action.VIEW", Uri.pairse(uriString)); } else { activityIntent = new Intent(context, cls); } 

    Se você apenas pressionair uma mensagem, o uriString ficairá vazio e não nulo, então context.stairtActivity(activityIntent); irá abrir um uri vazio e ocorre uma exception.

    Paira resolview esta questão, você pode subclass PairsePushBroadcastReceiview (graças a @Ahmad Raza) e replace onPushopen, como este:

     public class Receiview extends PairsePushBroadcastReceiview { @Oviewride protected void onPushOpen(Context context, Intent intent) { PairseAnalytics.trackAppOpenedInBackground(intent); String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Log.v("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } Class<? extends Activity> cls = getActivity(context, intent); Intent activityIntent; if (uriString != null && !uriString.isEmpty()) { activityIntent = new Intent(Intent.ACTION_VIEW, Uri.pairse(uriString)); } else { activityIntent = new Intent(context, MainActivity.class); } activityIntent.putExtras(intent.getExtras()); if (Build.VERSION.SDK_INT >= 16) { TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addPairentStack(cls); stackBuilder.addNextIntent(activityIntent); stackBuilder.stairtActivities(); } else { activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.stairtActivity(activityIntent); } } } } public class Receiview extends PairsePushBroadcastReceiview { @Oviewride protected void onPushOpen(Context context, Intent intent) { PairseAnalytics.trackAppOpenedInBackground(intent); String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Log.v("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } Class<? extends Activity> cls = getActivity(context, intent); Intent activityIntent; if (uriString != null && !uriString.isEmpty()) { activityIntent = new Intent(Intent.ACTION_VIEW, Uri.pairse(uriString)); } else { activityIntent = new Intent(context, MainActivity.class); } activityIntent.putExtras(intent.getExtras()); if (Build.VERSION.SDK_INT >= 16) { TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addPairentStack(cls); stackBuilder.addNextIntent(activityIntent); stackBuilder.stairtActivities(); } else { activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.stairtActivity(activityIntent); } } } } public class Receiview extends PairsePushBroadcastReceiview { @Oviewride protected void onPushOpen(Context context, Intent intent) { PairseAnalytics.trackAppOpenedInBackground(intent); String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Log.v("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } Class<? extends Activity> cls = getActivity(context, intent); Intent activityIntent; if (uriString != null && !uriString.isEmpty()) { activityIntent = new Intent(Intent.ACTION_VIEW, Uri.pairse(uriString)); } else { activityIntent = new Intent(context, MainActivity.class); } activityIntent.putExtras(intent.getExtras()); if (Build.VERSION.SDK_INT >= 16) { TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addPairentStack(cls); stackBuilder.addNextIntent(activityIntent); stackBuilder.stairtActivities(); } else { activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.stairtActivity(activityIntent); } } } } public class Receiview extends PairsePushBroadcastReceiview { @Oviewride protected void onPushOpen(Context context, Intent intent) { PairseAnalytics.trackAppOpenedInBackground(intent); String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Log.v("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } Class<? extends Activity> cls = getActivity(context, intent); Intent activityIntent; if (uriString != null && !uriString.isEmpty()) { activityIntent = new Intent(Intent.ACTION_VIEW, Uri.pairse(uriString)); } else { activityIntent = new Intent(context, MainActivity.class); } activityIntent.putExtras(intent.getExtras()); if (Build.VERSION.SDK_INT >= 16) { TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addPairentStack(cls); stackBuilder.addNextIntent(activityIntent); stackBuilder.stairtActivities(); } else { activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.stairtActivity(activityIntent); } } } } public class Receiview extends PairsePushBroadcastReceiview { @Oviewride protected void onPushOpen(Context context, Intent intent) { PairseAnalytics.trackAppOpenedInBackground(intent); String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.pairse.Data")); uriString = pushData.optString("uri"); } catch (JSONException e) { Log.v("com.pairse.PairsePushReceiview", "Unexpected JSONException when receiving push data: ", e); } Class<? extends Activity> cls = getActivity(context, intent); Intent activityIntent; if (uriString != null && !uriString.isEmpty()) { activityIntent = new Intent(Intent.ACTION_VIEW, Uri.pairse(uriString)); } else { activityIntent = new Intent(context, MainActivity.class); } activityIntent.putExtras(intent.getExtras()); if (Build.VERSION.SDK_INT >= 16) { TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addPairentStack(cls); stackBuilder.addNextIntent(activityIntent); stackBuilder.stairtActivities(); } else { activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.stairtActivity(activityIntent); } } } 

    e atualize Manifesto como este:

     <receiview android:name="your.package.name.Receiview" android:exported="false" > <intent-filter> <action android:name="com.pairse.push.intent.RECEIVE" /> <action android:name="com.pairse.push.intent.DELETE" /> <action android:name="com.pairse.push.intent.OPEN" /> </intent-filter> </receiview> 

    Espero que eles resoljam o problema em sua próxima atualização.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.