Stop receiving notification from a legacy Firebase project in Android application after applying config from the new one?
I have an Android application, it contains the google-services.json
config of the Firebase project to support notifications and the app was already published to Google Play. Now, I change my application to a new Firebase project but it still receives notification from both the new Firebase and the legacy. I don't have permission to manage the legacy Firebase but I don't want it to push notification to my application anymore so How do I achieve this? thanks
See also questions close to this topic
-
How to know if activity is created?
In a project there will be lots of pages(activities) and user will be able to switch between these pages (activities). So when user press the corresponding button that opens page_2 from page_1, I need to create a new Activity. However, if user comes back to page_1 and try to open the page_2 again, there will be a new Activity created again, instead of opening the previously created activity ( I want user to see the page_2 as he/she left it without anychanges). So I want to put something like
if(SecondActivity==null) { //Create new activity } start(new_activity);
Here is the corresponding code ( I couldn't implement onClickListener because I couldn't disable it in
onPause()
method... so I usedonClick
from xml)public class MainActivity extends Activity { private View.OnClickListener openSecondPage = new View.OnClickListener() { @Override public void onClick(View v) { Button button_newPage = findViewById(R.id.button_newpage); button_newPage.setText("Clicked"); Intent secondPage = new Intent(getApplicationContext(), SecondActivity.class ); startActivity(secondPage); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onResume(){ super.onResume(); //Button button_newPage = findViewById(R.id.button_newpage); // button_newPage.setOnClickListener(openSecondPage); } public void onPause(){ super.onPause(); //Destroy the on click listener Button button_newPage = findViewById(R.id.button_newpage); // button_newPage.setOnClickListener(null); } public void openSecondPage(View v) { Intent secondPage = new Intent(getApplicationContext(), SecondActivity.class ); startActivity(secondPage); } }
Edit: Here is the new code with Flags:
MainActivity.java code:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onResume(){ super.onResume(); } public void onPause(){ super.onPause(); } public void openSecondPage(View v) { Intent secondPage = new Intent(getApplicationContext(), SecondActivity.class ); secondPage.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); startActivity(secondPage); } }
SecondActivity.java code:
public class SecondActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.secondactivity); } protected void onResume() { super.onResume(); } public void goBack(View v) { } public void goMainPage(View v) { Intent mainPage = new Intent(getApplicationContext(),MainActivity.class); mainPage.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); startActivity(mainPage); } }
-
Server throwing broken pipe exception
Now I am working on client-server application, client side using exoplayer to request video file from server (struts based server), when the exoplayer first time requesting video source, struts throws IOException: Broken pipe, but it loads the video file successfully on the second try. On server side throws such exception every time the client restarts.
On the some posts, I saw some said that client closing connection, but here exoplayer requests the source and i don't know how to increase timeout for the its connection. Please help me to figure out the problem?
Error:
Jan 26, 2021 3:35:24 PM com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor error SEVERE: java.io.IOException: Broken pipe org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:351) at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:776) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:298) at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:251) at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:157) at org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:305) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:193) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:372) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276) at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:168) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:140) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:575) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcherImpl.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:140) at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101) at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:152) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1261) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:793) at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:563) at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:501) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:538) at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:112) at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:190) at org.apache.coyote.Response.doWrite(Response.java:601) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:339) ... 77 more
-
Android ACRA crash reporting problem on 4.3 Android version
My application.java looks like this:
@AcraCore(buildConfigClass = BuildConfig.class, reportFormat= StringFormat.JSON) @AcraHttpSender(uri="my_url", httpMethod=org.acra.sender.HttpSender.Method.POST) public class MyApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); ACRA.init(this); } }
and when I start an app on Android 4.3 (Sony Xperia T) app crashes on
ACRA.init(this)
. I was testing also on Android 9 and there is no problem. This is error log:java.util.ServiceConfigurationError: Couldn't instantiate class org.acra.config.HttpSenderConfigurationBuilderFactory at java.util.ServiceLoader$ServiceIterator.next(ServiceLoader.java:216) at org.acra.plugins.ServicePluginLoader.loadInternal(ServicePluginLoader.java:61) at org.acra.plugins.ServicePluginLoader.load(ServicePluginLoader.java:38) at org.acra.config.BaseCoreConfigurationBuilder.configurationBuilders(BaseCoreConfigurationBuilder.java:58) at org.acra.config.BaseCoreConfigurationBuilder.preBuild(BaseCoreConfigurationBuilder.java:87) at org.acra.config.CoreConfigurationBuilder.build(CoreConfigurationBuilder.java:846) at org.acra.ACRA.init(ACRA.java:160) at org.acra.ACRA.init(ACRA.java:144) at org.acra.ACRA.init(ACRA.java:127) at pl.jawegiel.endlessblow.MyApplication.attachBaseContext(MyApplication.java:18) at android.app.Application.attach(Application.java:181) at android.app.Instrumentation.newApplication(Instrumentation.java:991) at android.app.Instrumentation.newApplication(Instrumentation.java:975) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4539) at android.app.ActivityThread.access$1300(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1358) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:213) at android.app.ActivityThread.main(ActivityThread.java:5225) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.acra.config.HttpSenderConfigurationBuilderFactory" on path: DexPathList[[zip file "/data/app/pl.jawegiel.endlessblow-2.apk"],nativeLibraryDirectories=[/data/app-lib/pl.jawegiel.endlessblow-2, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at java.util.ServiceLoader$ServiceIterator.next(ServiceLoader.java:214) at org.acra.plugins.ServicePluginLoader.loadInternal(ServicePluginLoader.java:61) at org.acra.plugins.ServicePluginLoader.load(ServicePluginLoader.java:38) at org.acra.config.BaseCoreConfigurationBuilder.configurationBuilders(BaseCoreConfigurationBuilder.java:58) at org.acra.config.BaseCoreConfigurationBuilder.preBuild(BaseCoreConfigurationBuilder.java:87) at org.acra.config.CoreConfigurationBuilder.build(CoreConfigurationBuilder.java:846) at org.acra.ACRA.init(ACRA.java:160) at org.acra.ACRA.init(ACRA.java:144) at org.acra.ACRA.init(ACRA.java:127) at pl.jawegiel.endlessblow.MyApplication.attachBaseContext(MyApplication.java:18) at android.app.Application.attach(Application.java:181) at android.app.Instrumentation.newApplication(Instrumentation.java:991) at android.app.Instrumentation.newApplication(Instrumentation.java:975) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4539) at android.app.ActivityThread.access$1300(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1358) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:213) at android.app.ActivityThread.main(ActivityThread.java:5225) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525)
and there is many more errors like:
java.util.ServiceConfigurationError: Couldn't instantiate class org.acra.config.DialogConfigurationBuilderFactory java.util.ServiceConfigurationError: Couldn't instantiate class org.acra.collector.ConfigurationCollector Couldn't instantiate class ...
and so on.
What is the minimum Android version required for ACRA crash reporting? But maybe there is another problem?
-
show event parameter after click event name firebase event
I want to make event in firebase analytics like
page_view
event. So after we click eventpage_view
in events menuin the next page, I want to show card / menu like image below
I want to count user interaction on specific page. In this case, I want to count how many times user go to page
dashboard
. I have tried using js code like below, but after I click event name, in exampleuser
, it doesn't show card in image I want above.Here's the code
<script> // Initialize Firebase firebase.initializeApp(firebaseConfig); firebase.analytics().setUserProperties({name: 'dashboard_admin'}); firebase.analytics().logEvent('user',{content_id: 'dashboard_admin'); </script>
Any clue would be very helpful
-
How to prevent images from firebase storage to be downloaded every time on filter
I'm using firebase storage to load images into my web page. I have a page where I show different kinds of projects. I also provided a filter option. That is where I have my problem now. Every time users use a filter, the images from the firebase storage are downloaded again.
This is the code where I map over all my projects to show the project component.
{newProjects.map((project) => ( <Project project={project} key={project.id}></Project> ))}
In my project component, I use the project data to download the right image.
const imgRef = useRef(null); const storageRef = firebase.storage().ref(); storageRef .child('images/' + project.image) .getDownloadURL() .then(function (url) { imgRef.current.src = url; } }); return ( <img className={style.card_image} ref={imgRef} alt={project.title} </img> )
The projects are loaded in with the right images, great! The problem now is that if a user uses a filter, the images from the projects are downloaded from firebase again. The newProjects are a state and whenever I use the filter I will set the state again.
const [newProjects, setNewProjects] = useState(projects); const filter = () => { // filter stuff... setNewProjects(filteredProjects); }
Is there a way that the images won't download every time the users use a filter.
-
Firebase Vuexfire infinite loading. How to achieve showing the next results using vuexfire?
I am building the shop search project. I have two shop types in Product collection. The types are Supermarket and Restaurant.
In my menu.js file, I am setting the type in actions section, then I am showing the results in the Result.vue file.
When Result.vue is loaded, setMenuRef in menu.js is dispatched and the information is pushed into the array named getMenuItems.
If I press the supermarket button in Buttons.vue component, the current type is set to be Supermarket and then, I can see the results of shops which are categorized as Supermarket.
And if I press the restaurant button, I can see the results of shops which are categorized as Restaurant. The both methods are same.
What I want to achieve is, to add the loading functions for showing the next 8 results in the each result page.
I am searching the multiple websites to add the loading functions in vuexfire code. But I could not see what an approach is the best.
In Result.vue, I used the method for loading the new results. The method name is nextPage.
The logic in menu.js is bit complicated. Please feel free to ask me about the further information.
menu.js
import { firestoreAction } from 'vuexfire' import fireApp from '@/plugins/firebase' const firebase = require("firebase"); require("firebase/firestore"); const db = firebase.firestore(); const dbMenuRef = db.collection('Product').where("saleStatus", "==", 1).limit(8) const state = { currentType: 'menu', menuItems:[], store:[], supermarketItems:[], restaurantItems: [] } const getters = { currentType: state => state.currentType, getMenuItems: state => state.menuItems, supermarketItems: state => state.supermarketItems, restaurantItems: state => state.restaurantItems } const mutations = { setCurrentType(state, type) { state.currentType = type }, showSupermarketResult(state, supermarket) { state.supermarketItems.push(supermarket); }, showRestaurantResult(state, restaurant) { state.restaurantItems.push(restaurant); }, } const actions = { setMenuRef: firestoreAction(context => { return context.bindFirestoreRef('menuItems', dbMenuRef) }), setCollectionType: ({ commit, state }, type) => { commit('setCurrentType', type) const mutations = { Supermarket: 'showSupermarketResult', Restaurant: 'showRestaurantResult' } const states = { Supermarket: 'supermarketItems', Restaurant: 'restaurantItems' } if (state[states[type]].length) return const collectionRef = db.collection('Product').where("saleStatus", "==", 1).where('type', '==', type).limit(8) collectionRef.get() .then(snapshot => { if (snapshot.empty) { console.log('No matching documents.'); return; } snapshot.forEach(doc => { const data = doc.data() commit(mutations[type], data) }); }) .catch(err => { console.log('Error getting documents', err); }); }, } export default { state, mutations, getters, actions }
Result.vue
<template> <div class="result-body"> <Navbar class="Navbar"/> <NavbarMobile class="NavbarMobile" /> <Map /> <Buttons /> <b-container v-if="currentType === 'menu'" class="result-container"> <b-row class="result-row "> <b-col md="6" v-for="(item, index) in getMenuItems" :key="index" class="container-result "> <div class="check d-flex flex-wrap flex-row " v-if="item.remainingQuantity >= 0"> <b-col cols="3" class="data"> <b-list-group class="list"> <div href="#" class="flex-column align-items-start"> <div class="d-flex justify-content-between"> <div class="item sale"> <div class="line"> <span class="initial">{{ item.initial }}</span> <br> </div> <span class="price">{{ item.sale }}</span> </div> </div> </div> <div href="#" disabled class="flex-column align-items-start limit-area"> <div class="d-flex justify-content-between"> <div class="item limit"> <div class="position"> Until <br>{{ item.limitObject }} </div> </div> </div> </div> </b-list-group> </b-col> <b-col cols="9"> <div v-if="item.remainingQuantity == 0"> <b-overlay :show="show" class="overlay" variant="dark" :opacity="opacity" :blur="blur" spinnerType="false"> <div class="image-card"> <router-link :to="{name:'Product',params:{id:item.id}}"> <div class="img" v-for="(sample, index) in item.sample" :key="index"> <b-img class="storefront" :src="sample" alt="Image 3"></b-img> </div> </router-link> <div class="card__content"> <div class="card__info"> <span class="business float-left">{{ item.business }}</span> <span class="quantity float-right">{{ item.remainingQuantity }} left</span> </div> </div> </div> </b-overlay> </div> <div v-else> <div class="image-card"> <router-link :to="{name:'Product',params:{id:item.id}}"> <div class="img" v-for="(sample, index) in item.sample" :key="index"> <b-img class="storefront" :src="sample" alt="Image 3"></b-img> </div> </router-link> <div class="card__content"> <div class="card__info"> <span class="business float-left">{{ item.business }}</span> <span class="quantity float-right">{{ item.remainingQuantity }} left</span> </div> </div> </div> </div> </b-col> </div> </b-col> </b-row> </b-container> <b-container v-if="currentType === 'Restaurant'" class="result-container"> <b-row class="result-row-restaurant "> <b-col md="6" v-for="(item, index) in restaurantItems" :key="index" class="container-result "> <div class="check d-flex flex-wrap flex-row " v-if="item.remainingQuantity >= 0"> <b-col cols="3" class="data"> <b-list-group class="list"> <div href="#" class="flex-column align-items-start"> <div class="d-flex justify-content-between"> <div class="item sale"> <div class="line"> <span class="initial">{{ item.initial }}</span> <br> </div> <span class="price">{{ item.sale }}</span> </div> </div> </div> <div href="#" disabled class="flex-column align-items-start limit-area"> <div class="d-flex justify-content-between"> <div class="item limit"> <div class="position"> Until <br>{{ item.limitObject }} </div> </div> </div> </div> </b-list-group> </b-col> <b-col cols="9"> <div v-if="item.remainingQuantity == 0"> <b-overlay :show="show" class="overlay" variant="dark" :opacity="opacity" :blur="blur" spinnerType="false"> <div class="image-card"> <router-link :to="{name:'Product',params:{id:item.id}}"> <div class="img" v-for="(sample, index) in item.sample" :key="index"> <b-img class="storefront" :src="sample" alt="Image 3"></b-img> </div> </router-link> <div class="card__content"> <div class="card__info"> <span class="business float-left">{{ item.business }}</span> <span class="quantity float-right">{{ item.remainingQuantity }} left</span> </div> </div> </div> </b-overlay> </div> <div v-else> <div class="image-card"> <router-link :to="{name:'Product',params:{id:item.id}}"> <div class="img" v-for="(sample, index) in item.sample" :key="index"> <b-img class="storefront" :src="sample" alt="Image 3"></b-img> </div> </router-link> <div class="card__content"> <div class="card__info"> <span class="business float-left">{{ item.business }}</span> <span class="quantity float-right">{{ item.remainingQuantity }} left</span> </div> </div> </div> </div> </b-col> </div> </b-col> </b-row> </b-container> <b-container v-if="currentType === 'Supermarket'" class="result-container" > <b-row class="result-row "> <b-col md="6" v-for="(item, index) in supermarketItems" :key="index" class="container-result "> <div class="check d-flex flex-wrap flex-row " v-if="item.remainingQuantity >= 0"> <b-col cols="3" class="data"> <b-list-group class="list"> <div href="#" class="flex-column align-items-start"> <div class="d-flex justify-content-between"> <div class="item sale"> <div class="line"> <span class="initial">{{ item.initial }}</span> <br> </div> <span class="price">{{ item.sale }}</span> </div> </div> </div> <div href="#" disabled class="flex-column align-items-start limit-area"> <div class="d-flex justify-content-between"> <div class="item limit"> <div class="position"> Until <br>{{ item.limitObject }} </div> </div> </div> </div> </b-list-group> </b-col> <b-col cols="9"> <div v-if="item.remainingQuantity == 0"> <b-overlay :show="show" class="overlay" variant="dark" :opacity="opacity" :blur="blur" spinnerType="false"> <div class="image-card"> <router-link :to="{name:'Product',params:{id:item.id}}"> <div class="img" v-for="(sample, index) in item.sample" :key="index"> <b-img class="storefront" :src="sample" alt="Image 3"></b-img> </div> </router-link> <div class="card__content"> <div class="card__info"> <span class="business float-left">{{ item.business }}</span> <span class="quantity float-right">{{ item.remainingQuantity }} left</span> </div> </div> </div> </b-overlay> </div> <div v-else> <div class="image-card"> <router-link :to="{name:'Product',params:{id:item.id}}"> <div class="img" v-for="(sample, index) in item.sample" :key="index"> <b-img class="storefront" :src="sample" alt="Image 3"></b-img> </div> </router-link> <div class="card__content"> <div class="card__info"> <span class="business float-left">{{ item.business }}</span> <span class="quantity float-right">{{ item.remainingQuantity }} left</span> </div> </div> </div> </div> </b-col> </div> </b-col> </b-row> </b-container> <b-button @click.prevent="nextPage" class="next">next</b-button> <Footer class="Footer" /> <FooterMobile class="FooterMobile"/> </div> </template> <script> import axios from 'axios'; import Navbar from "@/components/Navbar.vue"; import Buttons from "@/components/Buttons.vue"; import Map from "@/components/Map.vue"; import Footer from "@/sections/Footer.vue"; import NavbarMobile from "@/components/NavbarMobile.vue"; import FooterMobile from "@/sections/FooterMobile.vue"; import fireApp from '@/plugins/firebase' const firebase = require("firebase"); require("firebase/firestore"); const db = firebase.firestore(); import { mapGetters } from 'vuex' export default { name: "Result", data() { return { show: true, opacity: 0.8, blur: '0px', status: "", address: "", error: "", spinner: false, fav: false, type: "menu", userId: "", productId: "", lastVisible: "", getMenuItems: [] } }, components: { Navbar, Map, Buttons, Footer, NavbarMobile, FooterMobile, }, computed: { ...mapGetters([ 'currentType', 'getMenuItems', 'restaurantItems', 'supermarketItems' ]) }, created() { const dbMenuRef = db.collection('Product').where("saleStatus", "==", 1).limit(8) dbMenuRef.onSnapshot((snapshot) => { snapshot.forEach((doc) => { const quantity = doc.data().remainingQuantity console.log(quantity) //this.show = false this.productId = doc.data().id this.favoriteProduct = doc.data() this.$store.dispatch('setMenuRef', dbMenuRef) }) }) }, methods: { nextPage() { fireApp.auth().onAuthStateChanged((user) => { if (user) { const userId = fireApp.auth().currentUser.uid; const next = db.collection('Product').where("saleStatus", "==", 1).startAfter(this.lastVisible).limit(8) return next.onSnapshot((nextQuery) => { nextQuery.forEach((doc) => { const nextData = doc.data() console.log(nextData) this.getMenuItems.push(nextData) }) this.lastVisible = nextQuery.docs[nextQuery.docs.length-1]; }) }; }) } }, mounted() { this.$store.commit('setCurrentType', this.type) }, watch: { getMenuItems: { handler(getMenuItems) { //console.log('getMenuItems: ', getMenuItems); //Debug this.resultData = getMenuItems }, deep: true }, show: { handler(show) { this.show = show }, immediate: true } } } </script>
Buttons.vue
<template> <div> <section class="button-section"> <div class="d-flex buttons"> <b-button class="supermarket" @click.prevent="showCollection('Supermarket')">Supermarket</b-button> <b-button class="restaurant" @click.prevent="showCollection('Restaurant')">Restaurant</b-button> </div> </section> </div> </template> <script> import fireApp from '@/plugins/firebase' const firebase = require("firebase"); require("firebase/firestore"); const db = firebase.firestore(); import { mapGetters } from 'vuex' import store from '../store' export default { name: 'Buttons', data() { return { supermarket: "", restaurant: "" } }, methods: { showCollection(type) { this.$store.dispatch('setCollectionType', type) } } } </script>
-
Push notification android basic questions
I am about it implement push notification from a node.js-server into my Android/kotlin-app. Therefore i have used pusher.com which was very easy to implement for basic notifications
But: I want to create more costumizable notification, like a large image etc.
All the samples I find is about how to create a notification in Android.
e.g. this works great:
notificationManager = NotificationManagerCompat.from(this); val largeIcon = BitmapFactory.decodeResource(resources, R.drawable.large) val activityIntent = Intent(this, MainActivity::class.java) val contentIntent = PendingIntent.getActivity(this, 0, activityIntent, 0) val notification: Notification = NotificationCompat.Builder(this, App.CHANNEL_1_ID) .setContentText("test") .setContentTitle("test") .setSmallIcon(R.drawable.heizungan) .setPriority(NotificationCompat.PRIORITY_HIGH) .setLargeIcon(largeIcon) .setCategory(NotificationCompat.CATEGORY_MESSAGE) .setStyle(NotificationCompat.BigTextStyle() .bigText("test") .setBigContentTitle("test") .setSummaryText("Heizung")) .setPriority(NotificationCompat.PRIORITY_HIGH) .setCategory(NotificationCompat.CATEGORY_MESSAGE) .setColor(Color.RED) .setContentIntent(contentIntent) .setAutoCancel(true) .setOnlyAlertOnce(true) .build() notificationManager!!.notify(1, notification)
Using this in my app, i can create and show this notification. But how do I push this? How can I push some values to my device and then show this notification?
Thanks
-
Android Notification Timeout Listener
I did implement a notification feature in android using the Notification.Builder in Android OREO+. I need to cancel the notification after a certain time frame, if the user has not clicked on the notification. which i completed using the setTimeOutAfter method.
https://developer.android.com/reference/android/app/Notification.Builder.html#setTimeoutAfter(long).
Now, i need to send a message to server that the notification wasn't clicked/timeout has occured. How can i implement this? Is there any notificationTimeout Listener?
-
Notifee android notitication icon not working
Notifee Notification icon not working in the notifee display notification
notifee.displayNotification({ title: remoteMessage.notification.title, body: remoteMessage.notification.body, android: { channelId: 'android_id', }, });
I have used so many things like, small_icon,large_icon and other ways but notification icon is not diplaying it is just showing a default image.
I also checked with AndroidManifest meta data tags, they are also not working.