broadcastreceiver

Dynamic register of C2DM receiver using registerReceiver

不打扰是莪最后的温柔 提交于 2019-12-05 10:46:07
I can register my android app with C2DM successfully using a <receiver> in my manifest. However, if I delete the <receiver> from the manifest and register my receiver using the method registerReceiver of the context, I receive a SERVICE_NOT_AVAILABLE error response. I have reproduced this behaviour in the emulator and in a real device. Is dynamically registering a C2DM receiver possible? This is the fragment of the manifest I deleted: <receiver android:name=".service.C2DM.C2DMReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com

Android - BroadcastReceiver unregisterReceiver issue (not registered)

主宰稳场 提交于 2019-12-05 10:32:09
I'm having some problems unregistering a BroadcastReceiver . I'm first registering it but then when I want to unregister it by using unregisterReceiver(); command gives me tons of errors. The error says that I've not registered my BroadcastReceiver . Code: public class Receiver extends BroadcastReceiver implements Variables { CheckConexion cc; @Override public void onReceive(Context contxt, Intent intent) { // Cuando hay un evento, lo diferenciamos y hacemos una acción. if (intent.getAction().equals(SMS_RECEIVED)) { Sms sms = new Sms(null, contxt); sms.uploadNewSms(intent); } else if (intent

service not started on BOOT COMPLETE

不羁岁月 提交于 2019-12-05 10:31:48
I have a service that I would like to start on BOOT COMPLETE when it is started , I have a toast message displayed. my problem is that when the device boots up , the toast is displayed and is stuck on screen, and the service is not starting correctly. however if I am trying to start my service through an activity , the service is starting well and the toast disappears after a few seconds correctly. my manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.tfl.extprotocolservice" android:versionCode="7" android:versionName="1.6" > <uses-sdk android

How to use implicit broadcast PACKAGE_ADDED in Oreo (8.0)?

蓝咒 提交于 2019-12-05 10:24:22
I have to receive system-sent implicit broadcasts (ACTION_PACKAGE_ADDED) to detect the installation of the application and perform some code. I used the code below: public class Receiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { // It will trigger when any app is installed Uri data = intent.getData(); String packageAdv = data.getEncodedSchemeSpecificPart(); //some code... } } In my Manifest file I declared my receiver: <receiver android:name="com.myapp.Receiver"> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED" />

android: response from market activity

纵然是瞬间 提交于 2019-12-05 10:00:00
I am trying to make an app that opens android market page of selected app & lets user download it.I have used below intent to open market. Intent intent = new Intent (Intent.ACTION_VIEW); intent.setData (Uri.parse ("market://details?id=" + PackageName )); intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); startActivityForResult (intent, 13); but I always get resultcode 0 in onActivityResult.StackTrace says: I/ActivityManager( 79): Starting activity: Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.apps.unveil flg=0x10000000 cmp=com.an droid.vending/

C2DMBroadcastReceiver's onReceive is not executing (For Registration)

≡放荡痞女 提交于 2019-12-05 09:23:20
Im developing a C2DM Messaging application. In that i order to receive the registration id im using the C2DMBroadcastReceiver , C2DMBaseReceiver and C2DMMessaging class. I will be C2DMReceiver in my package which extends the C2DMBaseReceiver . Here is my code snippet C2DMMessaging.java package com.google.android.c2dm; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.util.Log; public class C2DMessaging { public static final String EXTRA_SENDER

No ringing event on incoming calls

拈花ヽ惹草 提交于 2019-12-05 09:09:04
I don't know where is a problem. Listener doesn't catch onRinging event (so I can decide will I accept or reject incoming calls). in manifest is this: <uses-permission android:name="android.permission.USE_SIP" /> in main activity onCreate is this: IntentFilter filter = new IntentFilter(); filter.addAction("android.SipDemo.INCOMING_CALL"); callReceiver = new IncomingCallReceiver(); this.registerReceiver(callReceiver, filter); ... SipManager manager = SipManager.newInstance(this); Intent i = new Intent(); i.setAction("android.SipDemo.INCOMING_CALL"); PendingIntent pi = PendingIntent.getBroadcast

Stop broadcast receiver from a button in acivity

家住魔仙堡 提交于 2019-12-05 08:41:07
I want to stop and start a broadcast receiver through a button click. two services associated with the broadcast receiver should also stop and start with button click how can i do it.. this is the code............ b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub PackageManager pm = Re_editActivity.this.getPackageManager(); ComponentName componentName = new ComponentName(currentActivity.this, name_of_your_receiver.class); pm.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_ENABLED,

how to end up my outgoing call.

非 Y 不嫁゛ 提交于 2019-12-05 08:40:23
with statrtActivity(callIntent) , call goes and then i have to wait for few seconds and end automatically. to end up my call i have taken mycalss extends Broadcastreceiver then in that onreceive() i implemented.in that method i got only to set old number and newnumber and toast is printing. What i want exactly is to end call what i need to write. and how to call onreceive method from my class? plase help me. i didnt get anywhere. @Override public void onReceive(Context context, Intent intent) { final String oldNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); this.setResultData

Alarm Manager not working at specific given time interval

寵の児 提交于 2019-12-05 08:28:15
Hi I am using alarm Manager for specific time interval for 3 minutes and I started monitoring. It worked for sometimes and suddenly I noticed there is irregular time interval which is not correct! You can see in attached log where at "20-Jul-2016 12:22:03 pm" time varies! I connected the phone and turned off the screen and monitored! where for every 3 minutes, i hit the server and gets the response as 1. But at one time, it takes 5 minutes to hit the server! Why this strange issue happened? Here is code. public void startAt3() { Intent alarmIntent = new Intent(ActivityTracking.this,