BroadcastReceiver on notifications

0

I'm a newbie to the question of android I have the following doubt

I'm doing an application that sends notifications every day at user-determined times but I did not find content on the internet about it but some videos but they are very bad. In the middle of my research I came across the BroadcastReceiver so I do not know how to implement it if someone can help me in this.

    
asked by anonymous 27.05.2018 / 02:02

1 answer

0

The Broadcasts documentation is here . Inside the page there are exemplary implementations.

<receiver android:name=".MyBroadcastReceiver"  android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED"/>
        <action android:name="android.intent.action.INPUT_METHOD_CHANGED" />
    </intent-filter>
</receiver>


public class MyBroadcastReceiver extends BroadcastReceiver {
    private static final String TAG = "MyBroadcastReceiver";
    @Override
    public void onReceive(Context context, Intent intent) {
        StringBuilder sb = new StringBuilder();
        sb.append("Action: " + intent.getAction() + "\n");
        sb.append("URI: " + intent.toUri(Intent.URI_INTENT_SCHEME).toString() + "\n");
        String log = sb.toString();
        Log.d(TAG, log);
        Toast.makeText(context, log, Toast.LENGTH_LONG).show();
    }
}
    
28.05.2018 / 15:11