File tree Expand file tree Collapse file tree 1 file changed +54
-2
lines changed Expand file tree Collapse file tree 1 file changed +54
-2
lines changed Original file line number Diff line number Diff line change 1
- # NetworkProvider
2
- Ionic 3 Provider that detects the network change in application and notifies the user with an alert.
1
+ # Network Provider
2
+
3
+ Network Provider is an Ionic3-based provider that detects the network change in application and notifies the user with an alert.
4
+
5
+ - Import the provider in app.module and app.component
6
+ - Call the .networkDetect() function in app.component constructor
7
+ - See the magic!
8
+
9
+ ---
10
+ ### Installation
11
+
12
+ * app.module.ts*
13
+
14
+ ``` ts
15
+ import { Network } from ' @ionic-native/network' ;
16
+ import { NetworkProvider } from ' ../providers/network/network' ;
17
+
18
+ @NgModule ({
19
+ ...
20
+ providers : [
21
+ ...
22
+ Network ,
23
+ NetworkProvider ,
24
+ ],
25
+ })
26
+ ```
27
+
28
+ * app.component.ts*
29
+
30
+ ``` ts
31
+ import { NetworkProvider } from ' ../providers/network/network' ;
32
+
33
+ @Component ({
34
+ templateUrl: " app.html"
35
+ })
36
+ class MyApp {
37
+ constructor (network : NetworkProvider ) {
38
+ ...
39
+ network .detectNetwork ();
40
+ ... .
41
+ }
42
+ ...
43
+ }
44
+ ```
45
+
46
+ ### Todos
47
+
48
+ - Add Network Detection on first run of the application
49
+ - Add screenshots to README
50
+
51
+ License
52
+ ----
53
+
54
+ MIT
You can’t perform that action at this time.
0 commit comments