Skip to content

Commit

Permalink
ステップ2「アプリにネイティブ機能をつけよう」
Browse files Browse the repository at this point in the history
コアプラグイン「ローカル通知でユーザにお知らせしよう」
  • Loading branch information
rdlabo committed Sep 4, 2019
1 parent b7292f1 commit 9ab61a3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="io.ionic.starter">

<application
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
5 changes: 4 additions & 1 deletion android/app/src/main/assets/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"appName": "native-tutorial",
"bundledWebRuntime": false,
"npmClient": "yarn",
"webDir": "www"
"webDir": "www",
"server": {
"url": "http://192.168.0.17:8100"
}
}
5 changes: 4 additions & 1 deletion capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"appName": "native-tutorial",
"bundledWebRuntime": false,
"npmClient": "yarn",
"webDir": "www"
"webDir": "www",
"server": {
"url": "http://192.168.0.17:8100"
}
}
2 changes: 1 addition & 1 deletion src/app/tab1/tab1.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</ion-header>

<ion-content>
<ion-card class="welcome-card">
<ion-card class="welcome-card" (click)="localNotification()" button="true">
<img src="/assets/shapes.svg" alt="" />
<ion-card-header>
<ion-card-subtitle>Get Started</ion-card-subtitle>
Expand Down
14 changes: 14 additions & 0 deletions src/app/tab1/tab1.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { Plugins } from '@capacitor/core';

@Component({
selector: 'app-tab1',
Expand All @@ -9,4 +10,17 @@ export class Tab1Page {

constructor() {}

localNotification() {
Plugins.LocalNotifications.schedule({
notifications: [
{
id: 1,
title: 'ようこそ',
body: 'Ionic Frameworkへ',
schedule: { at: new Date(Date.now() + 1000 * 5) },
sound: 'normail'
}
]
});
}
}

0 comments on commit 9ab61a3

Please sign in to comment.