I have implemented Local Notification Code but not able to access it through android emulator or physical device .
Controller
constructor(public navCtrl: NavController, public navParams: NavParams,
private localNotifications : LocalNotifications,private plt : Platform,
private alertCtrl:AlertController) {
this.alarmsList = 'breathe';
this.plt.ready().then((rdy)=>{
this.localNotifications.on('click',(notification,state)=>{
let json = JSON.parse(notification.data);
let alert=this.alertCtrl.create({
title:notification.title,
subTitle:json.mydata
});
});
});
}
example(){
this.localNotifications.schedule({
id:1,
title:'Attention',
text:'Saurabh Notification',
at:new Date(new Date().getTime() + 1 * 1000),
data :{mydata:'hidden msg'}
});
View
<ion-list *ngSwitchCase="'breathe'" class="list-alarms">
<div class="list-header-custom breathe-time" text-uppercase text-center>
TEXT
<ion-fab bottom right edge>
<button ion-fab mini color="light" (click)="example()"><ion-icon name="add"></ion-icon></button>
</ion-fab>
</div>
Are you getting any errors?
No i am not getting any error on Android device .
In browser its says > include cordova.js
Does it show in the list of you use this.localNotifications.getAllScheduled()
? (Returns a Promise)
on Android !! how can I debug that
Oh
ionic cordova run android -lcs
Or remote debug
Thanks ,Let me do that & revert you on same
Not able to debug !!
Is my code appropriate ??
What happens when you run the command? Paste the console output
Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:processDebugManifest FAILED
BUILD FAILED
Total time: 58.986 secs
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\xampp\htdocs\smiletherapy\platforms\android\AndroidManifest.xml:27:9-31 Error:
Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run android (exit code 1).